<%@page import="com.alibaba.fastjson.JSONObject"%>
<%@page import="com.dingpeikeji.quickdeer.modules.base.web.FSysController"%>
<%@page import="com.dingpeikeji.quickdeer.core.common.utils.CookieUtils"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%
//cookie中的账号密码
String saveUserFor3Months = CookieUtils.getCookie(request, FSysController.SAVE_USER_FOR_TREE_MONTHS);
String loginUsername = "";
String loginPassword = "";
String saveUserFor3MonthsCheck = "";
if(saveUserFor3Months != null) {
	try{ // cookie异常不作处理
		JSONObject obj = JSONObject.parseObject(saveUserFor3Months);
		loginUsername = (String)obj.get("username");
		loginPassword = (String)obj.get("password");
		saveUserFor3MonthsCheck = "checked";
	} catch (Exception e){
		loginUsername = "";
		loginPassword = "";
		saveUserFor3MonthsCheck = "";
	}
}
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>霞客约车—专业的旅行用车平台</title>
<meta name="keywords" content="霞客约车网，霞客，约车,互联网巴士，巴士,xiake,xiakeyueche, bus，包车，用车，租车，大巴，直通车，车票，自助游，跟团游,接送机">
<meta name="description" content="霞客约车网是一款互联网+交通出行平台，联合专业客运企业提供各类包车、旅行车票及个性化的定制包车产品，产品包括日租包车、旅游包车、接送机/火车、自助游车票、跟团游巴士、机场直通车、定制包车等，致力于为用户提供更安全、更便捷、更集约的旅行用车服务。">
<link href="${ctxStatic}/jquery-select2/3.4/fselect2.min.css" rel="stylesheet" />
<link href="${ctxStatic }/xiake/css/style.css" rel='stylesheet' type='text/css' />
<script src="${ctxStatic}/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="${ctxStatic}/form-validate/jquery.validate.js" type="text/javascript"></script>
<script src="${ctxStatic }/xiake/js/slider.js"></script>
<script src="${ctxStatic }/xiake/js/jquery.reveal.js"></script>
<script src="${ctxStatic }/xiake/js/switch.js"></script>
<script src="${ctxStatic}/jquery-select2/3.4/select2.min.js" type="text/javascript"></script>
<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.3&key=21298d90aa36cffdcef53cae577ae45d&plugin=AMap.CitySearch"></script>
<style type="text/css">.red{color:#f44336;}.list-logo{width:75px;height:40px;}</style>
<script type="text/javascript">
//相乘
function accMul(arg1, arg2) {
	var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
	try {
		m += s1.split(".")[1].length;
	} catch (e) {
	}
	try {
		m += s2.split(".")[1].length;
	} catch (e) {
	}
	return Number(s1.replace(".", "")) * Number(s2.replace(".", ""))
			/ Math.pow(10, m);
}
$(function() {
	var bannerSlider = new Slider($('#banner_tabs'), {
		time : 5000,
		delay : 400,
		event : 'hover',
		auto : true,
		mode : 'fade',
		controller : $('#bannerCtrl'),
		activeControllerCls : 'active'
	});
	$('#banner_tabs .flex-prev').click(function() {
		bannerSlider.prev()
	});
	$('#banner_tabs .flex-next').click(function() {
		bannerSlider.next()
	});
	// 菜单选中效果
	$('.' + $('#menuInfo').val()).addClass("nac_action");
	$('.funcMenu').click(function() {
		var url = $(this).attr('data-url');
		if (url != '#') {
			window.location.href = $(this).attr('data-url');
		}
	});
	//<c:if test="${login == 'yes'}">
	$('#loginBtn').click();//</c:if>
	//<c:if test="${register == 'yes'}">
	$('#registerBtn').click();//</c:if>

	showCityInfo();
	//<c:if test="${empty login}">
	$('#backUrl').val(window.location.href);
	//</c:if>
	//所有下拉框使用select2
	$("select").select2();

	// 验证码
	$('#getValidateCodeBtn').click(function() {
		getValidateCode($('#mobile1').val(), 0)
	});
	$('#getValidateCodeBtn2').click(function() {
		getValidateCode($('#mobile2').val(), 0)
	});
	$('#getValidateCodeBtn3').click(function() {
		getValidateCode($('#mobile3').val(), 2)
	});
});

//获取用户所在城市信息
function showCityInfo() {
	//实例化城市查询类
	var citysearch = new AMap.CitySearch();
	//自动获取用户IP，返回当前城市
	citysearch.getLocalCity(function(status, result) {
		var cityinfo = '';
		if (status === 'complete' && result.info === 'OK') {
			if (result && result.city) {
				cityinfo = result.city;
			}
		} else {
			cityinfo = '常州市';
		}
		document.getElementById('cityinfo').innerHTML = cityinfo;
		$.post('${ctxFront}/json/getSiteidByName', {
			name : cityinfo
		}, function(data) {
			// 定位城市选中
			var $autocity = $('input[data-autocity="yes"]');
			$autocity.val(cityinfo);
			$autocity.next('input').val(data.siteid);
		});
	});
}
function getValidateCode(val, type) {
	$.post('${ctxFront}/sms/send', {
		phone : val,
		type : type
	}, function(data) {
		if (data != 'success') {
			alert(data);
		} else {
			alert('短信已经发送，请注意查收')
		}
	});
}
function subRegisterForm() {
	if (!$('#agreementInfo1').is(':checked')) {
		alert('请先同意《霞客约车网服务协议》！');
		return;
	}
	$('#registerForm').submit();
}
function subRegisterForm2() {
	if (!$('#agreementInfo2').is(':checked')) {
		alert('请先同意《霞客约车网服务协议》！');
		return;
	}
	$('#registerForm2').submit();
}
function resetPwd() {
	$.post('${ctxFront}/user/forgetPwd', $('#resetPassword').serialize(),
			function(data) {
				alert(data);
				if (data == '修改密码成功') {
					loginForm();
				}
			});
}
function resetPassword() {
	$("#loginForm").addClass("hide");
	$("#resetPassword").removeClass("hide");
}
function loginForm() {
	$("#resetPassword").addClass("hide");
	$("#loginForm").removeClass("hide");
}
</script>
<sitemesh:head />
</head>
<body>
	<div id="header">
		<div class="header">
			<div class="font_small_size">
				<div class="float_l"> 
					<div class="logo_img"><img class="loginbar_img" src="${ctxStatic }/xiake/images/logo2.png" /></div>
					<div class="cityinfo">当前城市：<span id="cityinfo">正在定位...</span></div>
					<a href="${ctxFront }/info/wxlogin">微信登录</a> 
						<c:if test="${not empty sessionScope.wx }">
							${sessionScope.wx.nickname }
						</c:if>
				</div>	
				<div class="loginbar">
					<img class="loginbar_img" src="${ctxStatic }/xiake/images/slogan.png" style="margin-right: 460px;" /><img class="loginbar_img" src="${ctxStatic }/xiake/images/phone.png">
				</div>
			</div>
		</div>
			<div class="clear"></div>
			<div class="narbar">
				<div class="nav">
					<div class="nav_c font_larger_size float_l">
						<ul id="menu">
							<li data-url="${ctxFront }/index" class="funcMenu index"><a>首页</a></li>
							<li data-url="${ctxFront }/indexTravelRent" class="funcMenu indexTravelRent"><a>旅游包车</a></li>
							<li data-url="${ctxFront }/indexDayRent" class="funcMenu indexDayRent"><a>按天包车</a></li>
							<li data-url="${ctxFront }/indexPickSend" class="funcMenu indexPickSend"><a>接送机/火车</a></li>
							<%-- <li data-url="${ctxFront }/indexRealsche" class="funcMenu indexRealsche"><a>AA拼车</a></li> --%>
							<li data-url="${ctxFront }/rentproduct/demands/form" class="funcMenu indexDemands"><a>定制包车</a></li>
							<!-- <li data-url="#" class="bccp indexRealsche"><a>旅行班车</a></li> -->
							<%-- <div class="nav_2 hide">
								<ul class="menu_2">
									<li data-url="${ctxFront }/indexWait" class="funcMenu">机场班车</li></br>
								</ul>
							</div> --%>
						</ul>
					</div>
					<div class="nav_a font_small_size float_r">
						<ul>
							<%-- 用户所属部门存在，且父部门ID为3表示普通单位 --%>
							<%-- <c:if test="${sessionScope.front_user.office.parent.id eq '3' }">
								<li><a href="${ctxFront }/officeup/tOfficeUp/form">升级服务商</a></li>
							</c:if> --%>
							<c:if test="${not empty sessionScope.front_user}">
								<li style="width:auto"><a href="${ctxFront }/orders/orderList">${sessionScope.front_user.loginName}的账号</a></li>
								<li><a href="${ctxFront }/logout">退出</a></li>
							</c:if>
							<c:if test="${empty sessionScope.front_user }">
								<li><a id="loginBtn" href="" data-reveal-id="login">登录</a></li>
								<li><a id="registerBtn" href="" data-reveal-id="register">注册</a></li>
							</c:if>
						</ul>
					</div>
					<div class="clear"></div>
					<c:if test="${empty sessionScope.front_user }">
						<div id="login" class="reveal-modal">
							<img id="reveal-modal-close" class="reveal-modal-close" src="${ctxStatic}/xiake/images/close_green.png"/>
							<form id="loginForm" action="${ctxFront}/login" method="post">
								<input id="backUrl" type="hidden" name="backUrl" />
								<div class="reveal-modal_login">登录</div>
								<div class="reveal-modal_logo">
									<img src="${ctxStatic }/xiake/images/logo.png">
								</div>
								<div class="reveal-modal_form">
									<div class="reveal-modal_form_input font_normal_size">
										<label>账号</label><br />
										<input type="text" name="username" class="text" value="<%=loginUsername%>" placeholder="请输入您的账号">
									</div>
									<div class="reveal-modal_form_input font_normal_size">
										<label>密码</label><br />
										<input type="password" class="text" name="password" value="<%=loginPassword %>" placeholder="请输入您的密码">
									</div>
									<div class="reveal-modal_form_checkbox font_normal_size" style="margin-left: 0;">
										<input style="vertical-align: middle;" name="saveUserFor3Months" type="checkbox" checked="checked" <%=saveUserFor3MonthsCheck %> value="yes">
										<span style="vertical-align: middle;">&nbsp;30天内自动登录</span>  
										<span class="float_r"><a onclick="resetPassword()">忘记密码</a></span>
									</div>
									<c:if test="${login == 'yes' and not empty message }">
									<div class="color_red font_small_size">
										${message}
									</div>
									</c:if>
									<div class="reveal-modal_form_submit font_large_size" onclick="$('#loginForm').submit();">
										<div class="pointer">立即登录</div>
									</div>
									<div class="reveal-modal_form_register font_small_size">
										<div>
											您还没有霞客约车账号，<a href="" data-reveal-id="register">免费注册</a>
										</div>
									</div>
								</div>
							</form>
							<form id="resetPassword" method="post" class="hide">
								<div class="reveal-modal_login">忘记密码</div>
								<div class="reveal-modal_form">
									<div class="reveal-modal_form_input font_normal_size">
										<label>手机号码</label><br />
										<input type="text" id="mobile3" name="mobile" class="text" placeholder="请输入您的账号">
										<span id="telephone" class="zhuche_span pointer">获取</span>
									</div>
									<div>
										<span id="telephoneRegist3"></span>
									</div>
									<div class="reveal-modal_form_input font_normal_size">
										<label>新密码</label><br />
										<input type="password" class="text" name="password1" placeholder="6-16位数字或英文字母">
									</div>
									<div class="reveal-modal_form_input font_normal_size">
										<label>确认密码</label><br />
										<input type="password" class="text" name="password2" placeholder="6-16位数字或英文字母">
									</div>
									<div class="reveal-modal_form_input font_normal_size">
										<label>验证码</label><br/>
										<input type="text" class="zhuche_input" name="validateCode" placeholder="输入手机上获得的验证码">
										<span id="getValidateCodeBtn3" class="zhuche_span pointer">获取</span>
									</div>
									<div class="color_red font_small_size"></div>
									<div class="reveal-modal_form_submit " onclick="resetPwd();">
										<div class="pointer">重置密码</div>
									</div>
									<div class="reveal-modal_form_register font_small_size">
										<div onclick="loginForm()">
											<a>已有账号登录</a>
										</div>
									</div>
								</div>
							</form>
						</div>
						<div id="register" class="reveal-modal">
							<img id="register-modal-close"  class="reveal-modal-close" src="${ctxStatic}/xiake/images/close_green.png"/>
							<form id="registerForm" action="${ctxFront}/doregister" method="post">
								<div class="reveal-modal_login">注册</div>
								<div class="reveal-modal_type font_normal_size">
									<div id="type_personal" class="reveal-modal_type_green">个人</div>
									<div id="type_enterprise" class="reveal-modal_type_grey">企业</div>
								</div>
								<div class="clear"></div>
								<div id="register_personal" class="reveal-modal_form font_normal_size">
									<div class="reveal-modal_form_inputr">
										<label>手机号码</label>
										<input type="text" id="mobile1" name="mobile" class="text requied" placeholder="请输入手机号码" >
									</div>
									<span id="telephoneRegist"></span>
									<div class="reveal-modal_form_inputr_verification">
										<label>短信验证码</label>
										<input type="text" name="validateCode" placeholder="请输入手机上获得的验证码" class="requied">
										<span id="getValidateCodeBtn" class="pointer"  >获取</span> 
									</div>
									<div class="reveal-modal_form_inputr">
										<label>密码</label>
										<input id="newPassword" name="newPassword" placeholder="6-16位数字或英文字母" type="password" class="text requied"/>
									</div>
									<span style="color: red" ></span>
									<div class="reveal-modal_form_inputr">
										<label>确认密码</label>
										<input id="confirmNewPassword" name="confirmNewPassword" placeholder="6-16位数字或英文字母" type="password" class="text requied"/>
									</div>
									
									<c:if test="${register == 'yes' and not empty message }">
										<div class="color_red font_small_size">
											${message}
										</div>
									</c:if>
									<div class="reveal-modal_form_checkbox font_small_size">
										<input id="agreementInfo1" type="checkbox" checked="checked" style="vertical-align: middle;"> 
										<span>同意<a target=_blank href="${ctxFront }/info/understand">《霞客约车网服务协议》</a></span>
									</div>
									<div class="reveal-modal_form_submit font_large_size" onclick="subRegisterForm()">
										<div class="pointer">提交</div>
									</div>
									<div class="reveal-modal_form_register font_small_size">
										<div>
											<a href="" data-reveal-id="login">已有账号登录</a>
										</div>
									</div>
									
								</div>
							</form>
							<form id="registerForm2" action="${ctxFront}/doregister" method="post">
								<input type="hidden" name="userType" value="1"/>
								<div id="register_enterprise" class="reveal-modal_form hide">
									<div class="reveal-modal_form_inputr font_normal_size">
										<label>企业名称</label>
										<input type="text" name="officeName" placeholder="请输入贵公司名称" class="requied">
									</div>
									<div class="reveal-modal_form_inputr font_normal_size">
										<label>经办人姓名</label>
										<input type="text" name="name" placeholder="输入您的姓名" class="requied">
									</div>
									<div class="reveal-modal_form_inputr font_normal_size">
										<label>手机号码</label>
										<input type="text" id="mobile2" name="mobile" placeholder="请输入您的手机号码" class="requied">
									</div>
									<div class="reveal-modal_form_inputr_verification font_normal_size">
										<label>验证码</label>
										<input type="text" name="validateCode" placeholder="输入手机上获得的验证码" class="requied">
										<span id="getValidateCodeBtn2" class="pointer">获取</span>
									</div>
									<div>
										<span id="telephoneRegist2"></span>
									</div>
									<div class="reveal-modal_form_inputr font_normal_size">
										<label>密码</label>
										<input type="password" name="newPassword"  placeholder="6-16位数字或英文字母" class="requied">
									</div>
									<div class="reveal-modal_form_inputr font_normal_size">
										<label>确认密码</label>
										<input type="password"  name="confirmNewPassword" placeholder="6-16位数字或英文字母" class="requied">
									</div>
									<c:if test="${register == 'yes' and not empty message }">
										<div class="color_red font_small_size">
											${message}
										</div>
									</c:if>
									<div class="reveal-modal_form_checkbox font_small_size">
										<input id="agreementInfo2" type="checkbox" checked="checked" style="vertical-align: middle;">
										<span>同意<a target=_blank href="${ctxFront }/info/understand">《霞客约车网服务协议》</a></span>
									</div>
									<div class="reveal-modal_form_submit font_large_size" onclick="subRegisterForm2();">
										<div class="pointer">提交</div>
									</div>
									<div class="reveal-modal_form_register font_small_size">
										<div>
											<a href="" data-reveal-id="login">已有账号登录</a>
										</div>
									</div>
									
								</div>
							</form>
						</div>
					</c:if>
				</div>
			</div>
	</div>
	<div class="clear"></div>
	<div id="container">
		<c:if test="${not empty messagesFor12Hour }">
			<div class="message font_small_size"><h3>温馨提示：</h3><p>${messagesFor12Hour }</p></div>
		</c:if>
		<c:if test="${not empty message and (login != 'yes'|| register != 'yes')}"><div class="message font_small_size"><h3>提示消息：</h3><p>${message }</p></div></c:if>
		<sitemesh:body />
	</div>
	<div id="footer">
		<div class="footer_c ">
			<div class="footer_l float_l ">
				<div class="footer_col float_l">
					<ul>
						<li class="font_normal_size" >公司信息</li>
						<li><a class="font_small_size" href="${ctxFront }/info/aboutUs">关于我们</a></li>
						<li class="hide"><a class="font_small_size" href="">新闻中心</a></li>
						<li><a class="font_small_size" href="${ctxFront }/info/disclaimer">免责说明</a></li>
						<li><a class="font_small_size" href="${ctxFront }/info/joinUs">联系我们</a></li>
					</ul>
				</div>
				<div class="footer_col float_l">
					<ul>
						<li class="font_normal_size" >新手指南</li>
						<li><a class="font_small_size" href="${ctxFront }/info/understand">用户须知</a></li>
						<li><a class="font_small_size" href="${ctxFront }/info/flow">约车流程</a></li>
						<li><a class="font_small_size" href="${ctxFront }/info/register">用户注册</a></li>
						<li class="hide"><a class="font_small_size" href="">用户反馈</a></li>
					</ul>
				</div>
				<div class="footer_col float_l">
					<ul class="hide">
						<li><a class="font_normal_size" href="">商务合作</a></li>
						<li><a class="font_small_size" href="">车辆加盟</a></li>
						<li><a class="font_small_size" href="">班车加盟</a></li>
						<li><a class="font_small_size" href="">联系我们</a></li>
					</ul>
				</div>
			</div>
			<div class="footer_r  float_l">
				<div class="footer_follow">
					<img src="${ctxStatic }/xiake/images/logo2.png" class="footer_logo" />
					<img src="${ctxStatic }/xiake/images/weibo.png" />
					<img src="${ctxStatic }/xiake/images/tdcode.png" />
				</div>
			</div>
		</div>
		<div class="footer_copyright">
			<p class="font_small_size">
				Copyright &copy; 2015-${fns:getConfig('copyrightYear')}
				<a href="${pageContext.request.contextPath}">${fns:getConfig('productName')}</a>
				- Powered By <a href="http://www.xiakayueche.com/">江苏热派网络科技有限公司</a>
				${fns:getConfig('version')} <a href="http://www.miibeian.gov.cn/">苏ICP备16039001号-1</a>
			</p>
		</div>
	</div>
	<script>$('.dpButton').css('background-color','red');</script>
	</body>
</html>